import request from '../utils/request';
import qs from 'qs';

var apiUrl = 'http://transfer.agoodme.com:8088/v1/transfer';
//var apiUrl = 'http://127.0.0.1:8088/v1/transfer';
//apiUrl = 'http://127.0.0.1:8088/v1/transfer';
var queryParams; 
var ClientId = 'MEPC';
var UserId = '562d8f1f00b0acaa476c7631';
var ContentType = 'application/json';
const Headers = {
  'X-Gli-Client-Id': ClientId,
  'X-Gli-User-Id': UserId,
  'Content-Type': ContentType,
};
//查询数据
export async function search() {
  var now = new Date();
  var url =  apiUrl+`/admin/transferfiles?${qs.stringify(queryParams)}`;
  //console.log("url="+url);
  return request(url, {
    method: 'get', 
    headers: Headers,
  });
}
//根据条件查询
export async function query(params) {
  var page = 1;  
  if ( undefined != params.page ) {
    page = params.page
  }
  
  const skip = (page - 1) * 10 ;      
  const limit = page * 10 ;
  queryParams = { ...params, page, skip, limit };
  return search();
}

//删除
export async function remove(params) {
  request(apiUrl+'/functionpoint/'+params.id, {
    method: 'delete',
    headers: Headers,
  });


  return search();
}



